package com.woniuxy.service.impl;

import com.woniuxy.dao.RbacMenuDao;
import com.woniuxy.entity.RbacMenu;
import com.woniuxy.entity.ResponseEntity;
import com.woniuxy.service.RbacMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 马宇航
 * @Todo: TODO
 * @DateTime: 22/02/24/0024 上午 11:21
 * @Component: 成都蜗牛学苑
 **/
@Service
public class RbacMenuServiceImpl implements RbacMenuService {
    @Autowired
    RbacMenuDao rbacMenuDao;
    @Override
    public ResponseEntity findAll() {
        List<RbacMenu> rbacMenuList = rbacMenuDao.findAll();
        return new ResponseEntity<List>(200,"菜单查询成功！",rbacMenuList);
    }

    @Override
    public ResponseEntity updateMenu(int fid, int id) {
        rbacMenuDao.updateMenu(fid,id);
        return new ResponseEntity(200,"菜单修改成功！",null);
    }

    @Override
    public ResponseEntity updateOne(RbacMenu rbacMenu) {
        int i = rbacMenuDao.updateOne(rbacMenu);
        if (i>0){
            return new ResponseEntity(200,"菜单修改成功！",null);
        }else{
            return new ResponseEntity(500,"菜单修改失败！",null);
        }
    }
}
